<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='lb'/></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">

            <div class="layui-form-item">
                <form name="totalForm" id="totalForm" action="${web_domain}/mall/merchant/check/list" method="get">

                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 80px;"><fmt:message key='dpmc'/></label>
                        <div class="layui-input-inline">
                            <input type="text" name="shopName" placeholder="<fmt:message key='qsrdpmc'/>" value="<c:if test='${params.shopName !=null}'>${params.shopName}</c:if>" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 80px;"><fmt:message key='lxr'/></label>
                        <div class="layui-input-inline">
                            <input type="text" name="realName" placeholder="<fmt:message key='qsrxm'/>" value="<c:if test='${params.realName !=null}'>${params.realName}</c:if>" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 80px;"><fmt:message key='lxdh'/></label>
                        <div class="layui-input-inline">
                            <input type="text" name="mobile" placeholder="<fmt:message key='qsrlxrdh'/>" value="<c:if test='${params.mobile !=null}'>${params.mobile}</c:if>" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 80px;"><fmt:message key='sjzt1'/></label>
                        <div class="layui-input-inline">
                            <select name="mainType">
                                <option value="0" <c:if test="${params.mainType eq 0}">selected</c:if>><fmt:message key='qxz'/></option>
                                <option value="1" <c:if test="${params.mainType eq 1}">selected</c:if>><fmt:message key='qy1'/></option>
                                <option value="2" <c:if test="${params.mainType eq 2}">selected</c:if>><fmt:message key='gth'/></option>
                                <option value="3" <c:if test="${params.mainType eq 3}">selected</c:if>><fmt:message key='gr'/></option>
                            </select>
                        </div>
                    </div>

                    <!-- 需要排序的字段 -->
                    <%--<input type="hidden" class="feijin-orderby" name="orderByGoodsNumber" id="orderByGoodsNumberParams" value="${params.orderByGoodsNumber}"/>--%>
                    <%--<input type="hidden" class="feijin-orderby" name="orderByTotalOrderAmount" id="orderByTotalOrderAmountParams" value="${params.orderByTotalOrderAmount}"/>--%>
                    <%--<input type="hidden" class="feijin-orderby" name="orderByTotalOrderNumber" id="orderByTotalOrderNumberParams" value="${params.orderByTotalOrderNumber}"/>--%>
                    <%--<input type="hidden" class="feijin-orderby" name="orderByMerchantEnterTime" id="orderByMerchantEnterTimeParams" value="${params.orderByMerchantEnterTime}"/>--%>
                    <!-- 需要排序的字段 -->
                    <input type="hidden" value="${params.merchantCheckStatus}" name="merchantCheckStatus"/>

                    <div class="layui-inline">
                        <button class="layui-btn layui-btn-sm layuiadmin-btn-list" id="search"><i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> <fmt:message key='ss'/></button>
                    </div>
                </form>
            </div>
        </div>

    </div>

    <div class="layui-card">
        <div class="layui-field-box layui-form">

            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li
                            <c:if test="${params.merchantCheckStatus eq 0}">class="layui-this"</c:if> >
                        <a href="${web_domain}/mall/merchant/check/list"
                           <c:if test="${params.merchantCheckStatus eq 0}">style="color: rgb(0, 150, 136)"</c:if> ><fmt:message key='qb'/></a>
                    </li>
                    <li <c:if test="${params.merchantCheckStatus eq 1}">class="layui-this"</c:if>>
                        <a href="${web_domain}/mall/merchant/check/list?merchantCheckStatus=1" <c:if test="${params.merchantCheckStatus eq 1}">style="color: rgb(0, 150, 136)"</c:if>><fmt:message key='dsh'/></a>
                    </li>
                    <li <c:if test="${params.merchantCheckStatus eq 2}">class="layui-this"</c:if>>
                        <a href="${web_domain}/mall/merchant/check/list?merchantCheckStatus=2" <c:if test="${params.merchantCheckStatus eq 2}">style="color: rgb(0, 150, 136)"</c:if>><fmt:message key='shtg'/></a>
                    </li>
                    <li <c:if test="${params.merchantCheckStatus eq 3}">class="layui-this"</c:if>>
                        <a href="${web_domain}/mall/merchant/check/list?merchantCheckStatus=3" <c:if test="${params.merchantCheckStatus eq 3}">style="color: rgb(0, 150, 136)"</c:if>><fmt:message key='shbtg'/></a>
                    </li>

                </ul>
            </div>

            <table class="layui-table" lay-size="sm">
                <thead>
                <%--<th width="5%"><input id="checkboxs" type="checkbox" value="${item.id}" lay-ignore lay-skin="primary"/></th>--%>
                <th><fmt:message key='sqsj'/></th>
                <th><fmt:message key='zh'/></th>
                <th><fmt:message key='dpmc'/></th>
                <th><fmt:message key='sjzt1'/></th>
                <th><fmt:message key='lxr'/></th>
                <th><fmt:message key='lxrdh'/></th>
                <th><fmt:message key='sjshzt'/></th>
                <th><fmt:message key='cz'/></th>
                </thead>
                <c:forEach items="${page.result}" var="item" varStatus="status">
                    <tr>
                        <%--<td><input type="checkbox" value="${item.id}" class="feijin-check" lay-ignore lay-skin="primary"/></td>--%>
                        <td><fmt:formatDate value="${item.merchantEnterTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                        <td>${item.username }</td>
                        <td>${item.shopName }</td>
                        <td>
                            <c:choose>
                                <c:when test="${item.mainType eq 1}"><fmt:message key='qy1'/></c:when>
                                <c:when test="${item.mainType eq 2}"><fmt:message key='gth'/></c:when>
                                <c:when test="${item.mainType eq 3}"><fmt:message key='gr'/></c:when>
                            </c:choose>
                        </td>
                        <td>${item.realName }</td>
                        <td>${item.mobile}</td>
                            <%--<td>${item.goodsNumber}</td>--%>
                            <%--<td><fmt:formatNumber value="${item.totalOrderAmount}" type="CURRENCY"/></td>--%>
                            <%--<td>${item.totalOrderNumber}</td>--%>
                        <td>
                            <c:choose>
                                <c:when test="${item.merchantCheckStatus eq 1}"><b style="color:blue;"><fmt:message key='shz'/></b></c:when>
                                <c:when test="${item.merchantCheckStatus eq 2}"><b style="color:green;"><fmt:message key='shtg'/></b></c:when>
                                <c:when test="${item.merchantCheckStatus eq 3}"><b style="color:red;"><fmt:message key='shbtg'/></b></c:when>
                            </c:choose>
                        </td>
                        <td>
                            <div class="layui-btn-container">

                                <a href="javascript:void(0);" data-id="${item.id}" class="layui-btn layui-btn-xs feijin-detail"><fmt:message key='ck'/></a>
                                <c:if test="${item.merchantCheckStatus eq 1}">
                                    <a href="javascript:void(0);" data-id="${item.id}" class="layui-btn layui-btn-normal layui-btn-xs feijin-check"><fmt:message key='sh'/></a>
                                </c:if>

                            </div>
                        </td>
                    </tr>
                </c:forEach>
            </table>
            <jsp:include page="/commons/page.jsp" flush="true"/>
        </div>
    </div>

</div>

<script>

    $(function () {

        //全选反选
        $("#checkboxs").click(function () {
            if (this.checked) {
                $(".feijin-check:checkbox").prop("checked", true);
            } else {
                $(".feijin-check:checkbox").prop("checked", false);
            }
        });

        //查看详情
        $(".feijin-detail").click(function () {

            var id = $(this).attr("data-id");

            layer.open({
                type: 2
                , title: '<fmt:message key='cksj'/>'
                , content: '${web_domain}/mall/merchant/' + id + '/detail'
                , maxmin: true
                , area: ['95%', '95%']
                , btn: ['<fmt:message key='fh'/>']
            });
        });

        //审核
        $(".feijin-check").click(function () {

            var id = $(this).attr("data-id");

            layer.open({
                type: 2
                , title: '<fmt:message key='shsjxx'/>'
                , content: '${web_domain}/mall/merchant/check/' + id + '/info'
                , maxmin: true
                , area: ['95%', '95%']
                , btn: ['<fmt:message key='qd1'/>', '<fmt:message key='qx'/>']
                , yes: function (index, layero) {
                    var submit = layero.find('iframe').contents().find("#submit");
                    submit.click();
                }
            });
        });


        //按商家入驻时间排序
        $("#orderByMerchantEnterTime").click(function () {
            $(".feijin-orderby").attr("value", "");
            var orderBy = "${params.orderByMerchantEnterTime}";

            if (orderBy == "asc") {
                $("#orderByMerchantEnterTimeParams").attr("value", "");
                $("#search").click();
                return;
            }

            if (orderBy == "desc") {
                $("#orderByMerchantEnterTimeParams").attr("value", "asc");
                $("#search").click();
                return;
            }

            if (orderBy == "") {
                $("#orderByMerchantEnterTimeParams").attr("value", "desc");
                $("#search").click();
                return;
            }
        });

        //按总订单笔数排序
        $("#orderByTotalOrderNumber").click(function () {
            $(".feijin-orderby").attr("value", "");
            var orderBy = "${params.orderByTotalOrderNumber}";

            if (orderBy == "asc") {
                $("#orderByTotalOrderNumberParams").attr("value", "");
                $("#search").click();
                return;
            }

            if (orderBy == "desc") {
                $("#orderByTotalOrderNumberParams").attr("value", "asc");
                $("#search").click();
                return;
            }

            if (orderBy == "") {
                $("#orderByTotalOrderNumberParams").attr("value", "desc");
                $("#search").click();
                return;
            }

        });

        //按总订单金额排序
        $("#orderByTotalOrderAmount").click(function () {
            $(".feijin-orderby").attr("value", "");
            var orderBy = "${params.orderByTotalOrderAmount}";

            if (orderBy == "asc") {
                $("#orderByTotalOrderAmountParams").attr("value", "");
                $("#search").click();
                return;
            }

            if (orderBy == "desc") {
                $("#orderByTotalOrderAmountParams").attr("value", "asc");
                $("#search").click();
                return;
            }

            if (orderBy == "") {
                $("#orderByTotalOrderAmountParams").attr("value", "desc");
                $("#search").click();
                return;
            }

        });

        //按在售商品数量排序
        $("#orderByGoodsNumber").click(function () {
            $(".feijin-orderby").attr("value", "");
            var orderBy = "${params.orderByGoodsNumber}";

            if (orderBy == "asc") {
                $("#orderByGoodsNumberParams").attr("value", "");
                $("#search").click();
                return;
            }

            if (orderBy == "desc") {
                $("#orderByGoodsNumberParams").attr("value", "asc");
                $("#search").click();
                return;
            }

            if (orderBy == "") {
                $("#orderByGoodsNumberParams").attr("value", "desc");
                $("#search").click();
                return;
            }

        });

    });
</script>
</body>
</fmt:bundle>
</html>